#include <iostream>
#include <queue>
#include <string.h>

using namespace std;

int n, m, x, y;

int qipan[500][500] = {0};
int vis[500][500] = {0};

struct Node
{
    int x;
    int y;
    int deepth = 0;
};


void bfs()
{
    Node root;
    root.x = x;
    root.y = y;

    queue<Node> q;
    q.push(root);
            vis[root.x][root.y] = 1;
    while(!q.empty())
    {
        Node now = q.front();

        qipan[now.x][now.y] = now.deepth;
        q.pop();
        
        int x, y;

        x = now.x + 2, y = now.y + 1;
        if(x > 0 && x <= n && y > 0 && y <= m && vis[x][y] == 0)
        {
            Node temp;
            temp.x = x, temp.y = y;
            temp.deepth = now.deepth + 1;
            q.push(temp);
            vis[x][y] = 1;
        }

        x = now.x + 1, y = now.y + 2;
        if(x > 0 && x <= n && y > 0 && y <= m && vis[x][y] == 0)
        {
            Node temp;
            temp.x = x, temp.y = y;
            temp.deepth = now.deepth + 1;
            q.push(temp);
            vis[x][y] = 1;
        }

        x = now.x + 1, y = now.y - 2;
        if(x > 0 && x <= n && y > 0 && y <= m && vis[x][y] == 0)
        {
            Node temp;
            temp.x = x, temp.y = y;
            temp.deepth = now.deepth + 1;
            q.push(temp);
            vis[x][y] = 1;
        }

        x = now.x + 2, y = now.y - 1;
        if(x > 0 && x <= n && y > 0 && y <= m && vis[x][y] == 0)
        {
            Node temp;
            temp.x = x, temp.y = y;
            temp.deepth = now.deepth + 1;
            q.push(temp);
            vis[x][y] = 1;
        }

        x = now.x - 2, y = now.y + 1;
        if(x > 0 && x <= n && y > 0 && y <= m && vis[x][y] == 0)
        {
            Node temp;
            temp.x = x, temp.y = y;
            temp.deepth = now.deepth + 1;
            q.push(temp);
            vis[x][y] = 1;
        }

        x = now.x - 2, y = now.y - 1;
        if(x > 0 && x <= n && y > 0 && y <= m && vis[x][y] == 0)
        {
            Node temp;
            temp.x = x, temp.y = y;
            temp.deepth = now.deepth + 1;
            q.push(temp);
            vis[x][y] = 1;
        }

        x = now.x - 1, y = now.y + 2;
        if(x > 0 && x <= n && y > 0 && y <= m && vis[x][y] == 0)
        {
            Node temp;
            temp.x = x, temp.y = y;
            temp.deepth = now.deepth + 1;
            q.push(temp);
            vis[x][y] = 1;
        }

        x = now.x - 1, y = now.y - 2;
        if(x > 0 && x <= n && y > 0 && y <= m && vis[x][y] == 0)
        {
            Node temp;
            temp.x = x, temp.y = y;
            temp.deepth = now.deepth + 1;
            q.push(temp);
            vis[x][y] = 1;
        }
    }
}

int main()
{
    cin >> n >> m >> x >> y;
    memset(qipan, -1, sizeof(qipan));

    bfs();

    for(int i = 1; i <= n ;i++)
    {
        for(int j = 1; j <=m; j++)
        {
            cout << qipan[i][j] << " ";
        }
        cout << endl;
    }
}